package com.kevin.es.user;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.math.BigDecimal;
import java.util.List;

/**
 * @author Kevin Liu
 * @date 2020/10/18 6:51 下午
 */
@Data
@Document(indexName = "book",shards = 5,replicas = 0)
@AllArgsConstructor
@NoArgsConstructor
public class Book {

    @Id
    @Field(type = FieldType.Long)
    private Long id;

    @Field(type = FieldType.Text,analyzer = "ik_max_word")
    private String bookName;

    @Field(type = FieldType.Text)
    private List<Long> categoryIds;

    @Field(type = FieldType.Long)
    private BigDecimal bookPrice;

    @Field(type = FieldType.Text,ignoreAbove = 255)
    private Reader reader;
}
